package cn.iune.erp.inventory;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

import com.justep.baas.data.RowState;


@Entity
@Table(name="StorageLedger",uniqueConstraints={@UniqueConstraint(name="storageLedger1", columnNames={"recordNo", "enterpriseNo"})})
@NamedQuery(name="StorageLedger.findAll", query="SELECT s FROM StorageLedger s")
public class StorageLedger {
	

	@Id
	@Column(length=36)
	private String fID;
	
	@Column(length=32)
	private String systemCode;
	@Column(length=4)
	private String billType;
	@Column(length=20)
	private String billTypeName;
	/*
	 * 1:入库
	 * 2:销货
	 * 3:领用
	 * 4:调拨
	 * 5:调整
	 */
	private int dealType = 0;

	private Date orderDate;
	@Column(length=10)
	private String state = "active";
	@Column(length=10)
	private String status = "open";
	@Column(length=10)
	private String audit = "active";

	private int flowType = 0;
	@Column(length=1)
	private String revOpay;
//	private int direction = 0;
	@Column(length=1)
	private String costingCode;
	private Date confirmDate;
	
	@Column(length=15)
	private String recordNo;
	
	@Column(length=32)
	private String factoryID;
	@Column(length=15)
	private String factoryNo;
	@Column(length=20)
	private String factoryName;
	
	@Column(length=3)
	private String tradeobjType;
	@Column(length=20)
	private String tradeobjTypeLabel;
	@Column(length=32)
	private String tradeobjID;
	@Column(length=32)
	private String tradeobjNo;
	@Column(length=20)
	private String shortName;
	@Column(length=128)
	private String tradeobjName;
	
	@Column(length=3)
	private String storageType;
	@Column(length=20)
	private String storageTypeLabel;
	@Column(length=32)
	private String storageID;
	@Column(length=32)
	private String storageNo;
	@Column(length=20)
	private String storageName;
	@Column(length=128)
	private String floorNo;
	
//	private String factoryNoOut;
//	private String factoryNameOut;
	@Column(length=3)
	private String currency;//币种
	@Column(length=20)
	private String currencyLabel;//币种
	@Column(precision=38,scale=6)
	private BigDecimal exchangeRate = BigDecimal.ZERO;//汇率
	private int printTimes = 0;//打印次数

	@Column(precision=10,scale=2)
	private BigDecimal itemQuantity = BigDecimal.ZERO;
	@Column(precision=10,scale=2)
	private BigDecimal pieceQuantity = BigDecimal.ZERO;
	
	@Column(precision=38,scale=2)
	private BigDecimal costingAmount = BigDecimal.ZERO;

	@Column(length=20)
	private String resultStatus = "待审核";
	
	@Column(columnDefinition="INT default 0",nullable=false)
	private int retailFlag = 0;//批发还是零售（0：批发，1：零售）
	
	@Column(columnDefinition="INT default 0 COMMENT '生成分录'",nullable=false)
	private int entryFlag = 0;//生成分录
	
	private int detailsCount = 0;
	private int detailsCountState = 0;
	
	private int maxDetailNo = 0;

//	@Column(length=65)
//	private String departmentNo;
//	@Column(length=256)
//	private String departmentName;
	@Column(length=256)
	private String employeeNo;
	@Column(length=256)
	private String employeeName;

	@Column(length=255)
	private String comments;
	
	@Column(length=15)
	private String cUsercode;
	@Column(length=20)
	private String cUsername;//制单人
	private Timestamp cDatetime;
	@Column(length=15)
	private String tUsercode;
	@Column(length=20)
	private String tUsername;//审核人
	private Timestamp tDatetime;
	@Column(length=15)
	private String eUsercode;
	@Column(length=20)
	private String eUsername;//关单人
	private Timestamp eDatetime;
	
	@Column(length=65)
	private String userId;

	@Column(length=128)
	private String enterpriseNo;
	@Column(length=128)
	private String enterpriseName;

	@Version
	private int version = 0;
	
	@Transient//非持久字段
	private RowState rowState;
	public RowState getRowState() {
		return rowState;
	}
	public void setRowState(RowState rowState) {
		this.rowState = rowState;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getCostingCode() {
		return costingCode;
	}

	public void setCostingCode(String costingCode) {
		this.costingCode = costingCode;
	}

	public String getSystemCode() {
		return systemCode;
	}

	public void setSystemCode(String systemCode) {
		this.systemCode = systemCode;
	}

	public String getEnterpriseNo() {
		return enterpriseNo;
	}

	public void setEnterpriseNo(String enterpriseNo) {
		this.enterpriseNo = enterpriseNo;
	}

	public String getEnterpriseName() {
		return enterpriseName;
	}

	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getStorageTypeLabel() {
		return storageTypeLabel;
	}

	public void setStorageTypeLabel(String storageTypeLabel) {
		this.storageTypeLabel = storageTypeLabel;
	}
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getOrderDate() {
		return orderDate;
	}

	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}
	
	public int getMaxDetailNo() {
		return maxDetailNo;
	}

	public void setMaxDetailNo(int maxDetailNo) {
		this.maxDetailNo = maxDetailNo;
	}

	public String getStorageType() {
		return storageType;
	}

	public void setStorageType(String storageType) {
		this.storageType = storageType;
	}

	public String getStorageNo() {
		return storageNo;
	}

	public void setStorageNo(String storageNo) {
		this.storageNo = storageNo;
	}

	public String getStorageName() {
		return storageName;
	}

	public void setStorageName(String storageName) {
		this.storageName = storageName;
	}

	public String getFloorNo() {
		return floorNo;
	}

	public void setFloorNo(String floorNo) {
		this.floorNo = floorNo;
	}

	public String getFactoryNo() {
		return factoryNo;
	}

	public void setFactoryNo(String factoryNo) {
		this.factoryNo = factoryNo;
	}

	public String getFactoryName() {
		return factoryName;
	}

	public void setFactoryName(String factoryName) {
		this.factoryName = factoryName;
	}

	public String getShortName() {
		return shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public String getcUsercode() {
		return cUsercode;
	}

	public void setcUsercode(String cUsercode) {
		this.cUsercode = cUsercode;
	}

	public String getcUsername() {
		return cUsername;
	}

	public void setcUsername(String cUsername) {
		this.cUsername = cUsername;
	}

	public Timestamp getcDatetime() {
		return cDatetime;
	}

	public void setcDatetime(Timestamp cDatetime) {
		this.cDatetime = cDatetime;
	}

	public String gettUsercode() {
		return tUsercode;
	}

	public void settUsercode(String tUsercode) {
		this.tUsercode = tUsercode;
	}

	public String gettUsername() {
		return tUsername;
	}

	public void settUsername(String tUsername) {
		this.tUsername = tUsername;
	}

	public Timestamp gettDatetime() {
		return tDatetime;
	}

	public void settDatetime(Timestamp tDatetime) {
		this.tDatetime = tDatetime;
	}

	public String geteUsercode() {
		return eUsercode;
	}

	public void seteUsercode(String eUsercode) {
		this.eUsercode = eUsercode;
	}

	public String geteUsername() {
		return eUsername;
	}

	public void seteUsername(String eUsername) {
		this.eUsername = eUsername;
	}

	public Timestamp geteDatetime() {
		return eDatetime;
	}

	public void seteDatetime(Timestamp eDatetime) {
		this.eDatetime = eDatetime;
	}
	
	public Date getConfirmDate() {
		return confirmDate;
	}

	public void setConfirmDate(Date confirmDate) {
		this.confirmDate = confirmDate;
	}

	public int getFlowType() {
		return flowType;
	}

	public void setFlowType(int flowType) {
		this.flowType = flowType;
	}

	public String getAudit() {
		return audit;
	}

	public void setAudit(String audit) {
		this.audit = audit;
	}

	public String getRevOpay() {
		return revOpay;
	}

	public void setRevOpay(String revOpay) {
		this.revOpay = revOpay;
	}

	public String getfID() {
		return fID;
	}
	public void setfID(String fID) {
		this.fID = fID;
	}
	
	public String getRecordNo() {
		return recordNo;
	}
	public void setRecordNo(String recordNo) {
		this.recordNo = recordNo;
	}
	public String getBillType() {
		return billType;
	}

	public void setBillType(String billType) {
		this.billType = billType;
	}

	public String getBillTypeName() {
		return billTypeName;
	}

	public void setBillTypeName(String billTypeName) {
		this.billTypeName = billTypeName;
	}
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
	public int getDetailsCountState() {
		return detailsCountState;
	}

	public void setDetailsCountState(int detailsCountState) {
		this.detailsCountState = detailsCountState;
	}

	public int getDetailsCount() {
		return detailsCount;
	}
	
	public void setDetailsCount(int detailsCount) {
		this.detailsCount = detailsCount;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public String getEmployeeNo() {
		return employeeNo;
	}
	public void setEmployeeNo(String employeeNo) {
		this.employeeNo = employeeNo;
	}
	public String getEmployeeName() {
		return employeeName;
	}
	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}
	public String getStorageID() {
		return storageID;
	}
	public void setStorageID(String storageID) {
		this.storageID = storageID;
	}
	public String getResultStatus() {
		return resultStatus;
	}
	public void setResultStatus(String resultStatus) {
		this.resultStatus = resultStatus;
	}
	public String getFactoryID() {
		return factoryID;
	}
	public void setFactoryID(String factoryID) {
		this.factoryID = factoryID;
	}
	public BigDecimal getPieceQuantity() {
		return pieceQuantity;
	}
	public void setPieceQuantity(BigDecimal pieceQuantity) {
		this.pieceQuantity = pieceQuantity;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	public String getCurrencyLabel() {
		return currencyLabel;
	}
	public void setCurrencyLabel(String currencyLabel) {
		this.currencyLabel = currencyLabel;
	}
	public BigDecimal getExchangeRate() {
		return exchangeRate;
	}
	public void setExchangeRate(BigDecimal exchangeRate) {
		this.exchangeRate = exchangeRate;
	}
	public int getPrintTimes() {
		return printTimes;
	}
	public void setPrintTimes(int printTimes) {
		this.printTimes = printTimes;
	}
	public int getRetailFlag() {
		return retailFlag;
	}
	public void setRetailFlag(int retailFlag) {
		this.retailFlag = retailFlag;
	}
	public int getEntryFlag() {
		return entryFlag;
	}
	public void setEntryFlag(int entryFlag) {
		this.entryFlag = entryFlag;
	}
	public int getDealType() {
		return dealType;
	}
	public void setDealType(int dealType) {
		this.dealType = dealType;
	}
	public BigDecimal getCostingAmount() {
		return costingAmount;
	}
	public void setCostingAmount(BigDecimal costingAmount) {
		this.costingAmount = costingAmount;
	}
	public BigDecimal getItemQuantity() {
		return itemQuantity;
	}
	public void setItemQuantity(BigDecimal itemQuantity) {
		this.itemQuantity = itemQuantity;
	}
	public String getTradeobjType() {
		return tradeobjType;
	}
	public void setTradeobjType(String tradeobjType) {
		this.tradeobjType = tradeobjType;
	}
	public String getTradeobjTypeLabel() {
		return tradeobjTypeLabel;
	}
	public void setTradeobjTypeLabel(String tradeobjTypeLabel) {
		this.tradeobjTypeLabel = tradeobjTypeLabel;
	}
	public String getTradeobjID() {
		return tradeobjID;
	}
	public void setTradeobjID(String tradeobjID) {
		this.tradeobjID = tradeobjID;
	}
	public String getTradeobjNo() {
		return tradeobjNo;
	}
	public void setTradeobjNo(String tradeobjNo) {
		this.tradeobjNo = tradeobjNo;
	}
	public String getTradeobjName() {
		return tradeobjName;
	}
	public void setTradeobjName(String tradeobjName) {
		this.tradeobjName = tradeobjName;
	}


	
	

}
